import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class LocalIOCopy {

	public static void main(String[] args) throws FileNotFoundException, IOException {
		if (args.length < 2) {
			System.err.println("Invalid parameters list. Usage: LocalIOCopy <source> <dest> ");
			System.exit(1);
		}
		String src = args[0];
		String dst = args[1];

		Copier copier = new StreamCopier();
		long before = System.currentTimeMillis();
		try (InputStream is = new BufferedInputStream(new FileInputStream(src));
				OutputStream os = new BufferedOutputStream(
						new FileOutputStream(dst))) {
			copier.copy(is, os, 100000);
		}
		long after = System.currentTimeMillis();
		System.out.print("Local IO : ");
		System.out.println(after - before);

	}

}
